<?php
/**
 * 本地测试用，非正式上线功能
 * 
 */
class demoAction extends apiAction {
	
	public function index(){
		$this->display();
	}
	 
	/**
	 * 用户登录
	 */
	public function login(){
		$this->display();
	}
	
	
	/**
	 * 打卡
	 */
	public function attendance(){
		$this->display();
	}
	
	/**
	 * 回帖接口测试
	 */
	public function addComment() {
		$this->display();
	}
	
	
	/**
	 * 添加巡检任务接口测试
	 */
	public function addTask() {
		
		$stores = D('store')->where(array('regionId' => array('in', $this->user['microAreaId'])))->select();
		$clients = D('customer')->select();
		
		$this->assign('stores', $stores);
		$this->assign('clients', $clients);
		
		$this->display();
	}
	
	
	/**
	 * 添加巡检图片接口测试
	 */
	public function addImages() {
		
		$stores = D('store')->where(array('regionId' => array('in', $this->user['microAreaId'])))->select();
		
		$this->assign('stores', $stores);
		
		$this->display();
	}
	
	
		
	/**
	 * 库存录入
	 */
	public function inventorySet() {
		
		$stores = D('store')->where(array('regionId' => array('in', $this->user['microAreaId'])))->select();
		
		$this->assign('stores', $stores);
		
		$this->display();
	}
	
	
	public function camera(){
		$this->saveAttachment('images');
		
		$images = array();
		
		$dir = C('pin_attach_path'). MODULE_NAME.'/'.date('Ymd');
		foreach (new DirectoryIterator($dir) as $fileInfo) {
			if($thumb = strstr($fileInfo->getFilename(), 'thumb_')){
				$images[] = $dir.'/'.$thumb;
			}
		}
		rsort($images);

		$images = array_slice($images, 0, 10);

		$this->assign('images', $images);
		$this->display();
	}
}

/* End of file demoAction.class.php */